﻿using System;
using System.Reflection;
using System.Web.Mvc;

using Ninject.Core;
using Ninject.Conditions;

using BlueSky.Web.Extentions;

using BlueSky.Web.IoC;

namespace BlueSky.Web.IoC.Ninject
{
    //public class AutoServiceModule : StandardModule, IAutoBinder
    //{
    //    protected readonly Assembly _assembly;

    //    /// <summary>
    //    /// Constructor.
    //    /// </summary>
    //    /// <param name="assembly">Specific assembly.</param>
    //    public AutoServiceModule(Assembly assembly)
    //    {
    //        _assembly = assembly;
    //    }

    //    public override void Load()
    //    {
    //        AutoBinderBase.BindAll(_assembly, this);
    //    }        

    //    public bool Filter(Type type)
    //    {
    //        return ResolveAsAttribute.IsDefined(type);
    //    }

    //    public void Binder(Type type)
    //    {
    //        ResolveAsAttribute[] atts = ResolveAsAttribute.GetAttributes(type);

    //        foreach (ResolveAsAttribute att in atts)
    //        {
    //            Bind(type).To(att.ImplementorType); //.Only(When.Context.AsController(att.ControllerType));
    //        }
    //    }
    //}
}
